<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: yangweijie <yangweijiester@gmail.com> <code-tech.diandian.com>
// +----------------------------------------------------------------------

namespace Help\Model;

use Think\Model;

/**
 * Class HelpComplainModel  投诉模型
 * @package Help\Model
 * @author:xjw129xjt xjt@ourstu.com
 */
class HelpComplainModel extends Model
{

    protected $tableName = 'help_complain';

    protected $_auto = array(
        array('create_time', NOW_TIME, self::MODEL_INSERT),
        array('update_time', NOW_TIME, self::MODEL_BOTH),
        array('status', '0', self::MODEL_INSERT),
    );

    protected $insertFields = 'help_id,uid,content,attach_ids';
    protected $updateFields = 'help_id,uid,content,attach_ids';

    public function addComplain($data)
    {
        $data = $this->create($data);
        $data['uid']=is_login();
        $res = $this->add($data);
        return $res;
    }

    public function getComplain($map=''){
        $map['status'] =1;
        $complain = $this->where($map)->select();
        return $complain;
    }

}